package ftp;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

public class FtpClient {
	public static void main(String[] args) throws UnknownHostException, IOException{
		Socket socket = new Socket("127.0.0.1",5555);
		InputStream nin = socket.getInputStream();
		OutputStream fout = new FileOutputStream("product-1-bk-sm2.jpg");
		byte[] buffer = new byte[256];
		int len = 0;
		while((len=nin.read(buffer))!=-1){
			fout.write(buffer, 0, len);
		}
		nin.close();
		fout.close();
		socket.close();
	}
}
